package com.example.sy2.demos.web.service;

import com.example.sy2.demos.web.entity.Grade;
import com.example.sy2.demos.web.entity.Student;
import com.example.sy2.demos.web.mapper.StudentRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StudentService {
    @Autowired
    private StudentRepository studentRepository;

    public List<Student> listAllStudents() {
        return studentRepository.findAll();
    }

    public Student getStudentById(Long studentId) {
        return studentRepository.findById(studentId).orElse(null);
    }

    public void addStudent(Student student) {
        studentRepository.save(student);
    }

    public List<Grade> getGradesByStudentId(Long studentId) {
        return null;
    }
}
